// 生成随机字符串
export function randomString(len) {
    len = len || 32;
    var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';    /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
    var maxPos = $chars.length;
    var pwd = '';
    for (var i = 0; i < len; i++) {
        pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
    }
    return pwd;
}

// 深拷贝
export function deepClone(target) {
    let result
    switch (Object.prototype.toString.call(target)) {
        case "[object Object]":
            result = {}
            for (const key in target) {
                if (target.hasOwnProperty(key)) {
                    result[key] = deepClone(target[key])
                }
            }
            break;
        case "[object Array]":
            result = []
            for (const i in target) {
                if (target.hasOwnProperty(i)) {
                    result[i] = deepClone(target[i])
                }
            }
            break;
        default:
            result = target
            break;
    }
    return result
}